<?php
$form = $this->beginWidget('CActiveForm', array(
        'id' => 'translate-form',       
        'enableAjaxValidation'=>false,
        'enableClientValidation'=>true,
        'clientOptions' => array('validateOnSubmit'=>true, 'validateOnType'=>true),
        'htmlOptions' => array('enctype' => 'multipart/form-data'),
        ));
?>
<?php 
$updated_fields = array();
if($model->updated_fields != NULL)
	$updated_fields = explode(',', $model->updated_fields);
?>
<div class="profile translate">
<?php $this->renderPartial('__basic', array('model' => $model, 'translatedModel' => $translatedModel, 'form' => $form, 'updated_fields' => $updated_fields));?>
<?php $this->renderPartial('__health', array('model' => $model, 'translatedModel' => $translatedModel, 'form' => $form));?>
<?php $this->renderPartial('__family', array('model' => $model, 'translatedModel' => $translatedModel, 'form' => $form, 'updated_fields' => $updated_fields));?>
<?php $this->renderPartial('__study', array('model' => $model, 'translatedModel' => $translatedModel, 'form' => $form, 'updated_fields' => $updated_fields));?>
<?php $this->renderPartial('__working', array('model' => $model, 'translatedModel' => $translatedModel, 'form' => $form, 'updated_fields' => $updated_fields));?>
<?php $this->renderPartial('__other', array('model' => $model, 'translatedModel' => $translatedModel, 'form' => $form, 'updated_fields' => $updated_fields));?>
<?php $this->renderPartial('__healthChecking', array('model' => $model, 'translatedModel' => $translatedModel, 'form' => $form));?>
</div>
<?php $this->endWidget(); ?>
<script type="text/javascript">
	LGCMS.addTooltip();
	$(function() {
	    $(".datepicker").datepicker({
	        'dateFormat': 'dd-mm-yy',
	        changeMonth: true,
	        changeYear: true,
	        'buttonImage': '<?php echo themeUrl(); ?>/images/datepicker.gif',
            'showOn': 'both',
            'buttonImageOnly': 'true',
            'buttonText': "Chọn ngày",
            'showAnim': 'slideDown',
            'yearRange': '-60:+0'
	    });
	});
</script>
<script type="text/javascript">
	$('#btnCancel').attr('onclick', '');
	$('#btnCancel').click(function(){
		LGCMS.kAlert('Thông báo', 'Bạn có muốn lưu dữ liệu trước khi thoát khỏi trang? <p style="text-align:center"><br /> <input type="button" class="button" value="Có" onclick="saveAndGoToGrid();"> <input type="button" class="button" value="Không" onclick="gotoGrid();"> <input type="button" class="button" value="Hủy" onclick="LGCMS.kAlertClose();"></p>', 400, 150);		
	});
	function saveAndGoToGrid(){
		LGCMS.kAlertClose();
		LGCMS.setTask('#translate-form', 'saveclose');
	};
	function gotoGrid()
	{
		window.location.href = '<?php echo url('/profile/index')?>';
	}
</script>
